#include<stdio.h>
#include<string.h>
int main()
{

int a = 0;
scanf("%d",&a);
int pan1 = 0;
int count = 0;
int k = 0;
scanf("%d",&k);
if(a%19==0)
{
    pan1 = 1;
}
char cc[20];
sprintf(cc,"%d",a);
for (int i = 0; i < strlen(cc); i++)
{
    if(cc[i]=='3')
    count++;
}
if(pan1 == 1&&count==k)
{
    printf("YES\n");
}
else
{
    printf("NO\n");
    

}

    return 0;
}